
package com.borqs.music.ui.online;

import static com.borqs.music.ui.online.OnlineTrackBrowserActivity.KEY_TYPE;
import static com.borqs.music.ui.online.OnlineTrackBrowserActivity.TYPE_HOT;
import static com.borqs.music.ui.online.OnlineTrackBrowserActivity.TYPE_LATEST;
import android.content.Intent;
import android.view.View;
import android.widget.TabHost;

import com.borqs.music.R;
import com.borqs.music.ui.GestureTabActivity;

public class OnlineCategoryActivity extends GestureTabActivity {
    private final static String HOT_DOWNLOAD_TAB_TAG = "hot_download_tab";
    private final static String LATEST_SONGS_TAB_TAG = "latest_songs_tab";
    private final static String SINGER_TAB_TAG = "singer_tab";
    private final static String ONLINE_SEARCH_TAB_TAG = "online_search_tab";

    @Override
    protected void onResume() {
        super.onResume();
        setTitle(R.string.tab_title_category);
    }

    @Override
    public int getTabCount() {
        return 4;
    }

    @Override
    protected void addTabs() {
        TabHost tabHost = getTabHost();
        Intent intent;
        // Add Hot Download Tab
        intent = new Intent();
        intent.setClass(this, OnlineTrackBrowserActivity.class);
        intent.putExtra(KEY_TYPE, TYPE_HOT);
        View hotDownloadIndicator = createIndicator(R.string.tab_title_hot_download, false);
        tabHost.addTab(tabHost.newTabSpec(HOT_DOWNLOAD_TAB_TAG)
                .setIndicator(hotDownloadIndicator)
                .setContent(intent));
        // Add Hot Like Tab
        intent = new Intent();
        intent.setClass(this, OnlineTrackBrowserActivity.class);
        intent.putExtra(KEY_TYPE, TYPE_LATEST);
        View hotLikeIndicator = createIndicator(R.string.tab_title_latest_songs, false);
        tabHost.addTab(tabHost.newTabSpec(LATEST_SONGS_TAB_TAG).setIndicator(hotLikeIndicator)
                .setContent(intent));

        // Add singer Tab
        intent = new Intent();
        intent.setClass(this, OnlineSingerCategoryActivity.class);
        View singerIndicator = createIndicator(R.string.tab_title_singer, false);
        tabHost.addTab(tabHost.newTabSpec(SINGER_TAB_TAG).setIndicator(singerIndicator)
                .setContent(intent));

        // Add online search Tab
        intent = new Intent();
        intent.setClass(this, OnlineSearchActivity.class);
        View searchIndicator = createIndicator(R.string.tab_title_search, false);
        tabHost.addTab(tabHost.newTabSpec(ONLINE_SEARCH_TAB_TAG).setIndicator(searchIndicator)
                .setContent(intent));
    }
}
